"""
name = 'suntao'
#  本人觉的类似与 js的 for in 循环
for k in name:
    print(k + '--', end="")
"""

#  按例： 找出 这段文字中的  a  不区分大小写
str1 = """As I sit down to write this letter to you, my heart is overflowing with emotions that I find difficult to express. You have brought so much joy and happiness into my life, and I feel blessed to have you by my side.
From the moment we met, I knew that you were someone special. Your smile, your laugh, your gentle touch - they all captured my heart and made me realize that I had found my soulmate. I feel a deep connection with you that I have never felt with anyone else.
Every moment we spend together is precious to me, and I cherish the memories we have created. I am grateful for the times we have laughed together, cried together, and simply enjoyed each other's company. You are the sunshine in my life that brightens up even the darkest of days.
I want you to know that I love you more than words can express. You have shown me what true love is, and I am forever grateful to you for that. I promise to always stand by your side, to support you, and to love you unconditionally.
Forever and always,"""

count = 0
for i in str1:
    if i.lower() == 'a':  # 转为小写
        count += 1

print(count)
print('A'.lower() == 'a')

# range()  语句用来生成一个 数字序列
# 用法1: range(5)   表示从0开始到5之间的数字   0，1，2，3，4
for k in range(5):
    print(f"{k}\t", end="")
print()
# 用法2: range(num1, num2)  包含开始不包含结尾
for k in range(5, 10):
    print(f"{k}\t", end="")
# 用法3: range(num1, num2, step)   step表示步长 一次要增加的值
print()
for k in range(10, 20, 2):
    print(f"{k}\t", end="")

# for循环案例 向小美表白
"""
i = 0
for i in range(1,101):
    print(f"今天是向小美表白的第{i}天")
    for j in range(1,11):
        print(f"这是第{i}天，送小美的第{j}束花")

print(f"第{i}天表白成功")
"""

# 九九乘法表案例
"""
for i in range(1, 10):
    for j in range(1, i + 1):
        print(f"{j} * {i} = {j * i}\t", end="")

    print()
"""
# 关键字 continue  和 break
"""
for i in range(10):
    if i % 2 == 0: continue
    print('我是奇数：%s' % i)
for i in range(10):
    if i >= 5: break
    print('我是小于5的数字：%d' % i)
"""
print()
# 终极案例  发工资

balance = 10000
for staff in range(1, 21):
    import random
    num = random.randint(1, 10)  # 随机生成1-10的绩效
    if num < 5:
        print(f"员工{staff},绩效分{num},低于5，不发工资，下一位")
        continue
    if balance < 1000:
        print('工资发放完了，下个月在领吧')
        break
    balance -= 1000
    print(f"员工{staff},发放工资1000元，账户剩余余额还有{balance}元")
